package com.example.keli.ui.my.adapter;

import android.content.Context;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.keli.R;
import com.example.keli.base.adapter.RecyclerAdapter;
import com.example.keli.base.adapter.RecyclerViewHolder;
import com.example.keli.base.utils.DensityUtil;
import com.example.keli.base.utils.GlideUtil;
import com.example.keli.base.utils.ScreenUtil;
import com.example.keli.ui.center.ActivieList;
import com.example.keli.ui.my.model.LoveReciveBean;
import com.example.keli.ui.my.model.UserInfo;

import java.util.List;

/**
 * description $desc$
 * created by jerry on 2019/3/18.
 */
public class MyActiveAdapter extends BaseQuickAdapter<UserInfo.ActivityListBean.DataBean, BaseViewHolder> {

    int width = 173 * 2;
    int height = 220 * 2;
    LinearLayout.LayoutParams layoutParams;
    private Context mContext;

    public MyActiveAdapter(List<UserInfo.ActivityListBean.DataBean> mData, Context context) {
        super(R.layout.item_my_active, mData);
        this.mContext = context;
        width = (ScreenUtil.getScreenWidth(context) - DensityUtil.dip2px(context, 24));
        height = width * 150 / 351;
        layoutParams = new LinearLayout.LayoutParams(width,height);
        layoutParams.gravity = Gravity.CENTER_HORIZONTAL;
    }

    @Override
    protected void convert(BaseViewHolder helper, UserInfo.ActivityListBean.DataBean mListBean) {
        helper.setText(R.id.tv_title, mListBean.getTitle());
        helper.setText(R.id.tv_tickets_num, String.format("票数:  %s", mListBean.getTicket_num()));
        helper.setText(R.id.tv_gifts_num, "礼物:  "+mListBean.getGift_num());
        ImageView imageView = helper.getView(R.id.iv_active);
        GlideUtil.displayRound(mContext, imageView, mListBean.getCover_picture(), 5);
        imageView.setLayoutParams(layoutParams);
    }
}
